package com.yyh.liuyanbantest;

import java.util.Objects;

public class Message {
    //属性
    //姓名
    private String name;
    //日期
    private String date;
    //标题
    private String title;
    //内容
    private String content;

    //有参构造方法
    public Message(String name, String date, String title, String content) {
        this.name = name;
        this.date = date;
        this.title = title;
        this.content = content;
    }
    //getter 和 setter 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
    //重写equals和hashCode方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Message message = (Message) o;
        return Objects.equals(name, message.name) && Objects.equals(date, message.date) && Objects.equals(title, message.title) && Objects.equals(content, message.content);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, date, title, content);
    }
    //重写toString方法
    @Override
    public String toString() {
        return "Message{" +
                "name='" + name + '\'' +
                ", date='" + date + '\'' +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                '}';
    }
}
